// import io from '@/module/io'
// import cookies from 'js-cookie'
let roleList = [
  {
    id: '1',
    userGroup: '角色1',
    remark: 'XXX1',
    status: 1,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,3'
  },
  {
    id: '2',
    userGroup: '角色2',
    remark: 'XXX2',
    status: 0,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,2'
  },
  {
    id: '3',
    userGroup: '角色3',
    remark: 'XXX3',
    status: 1,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,3'
  },
  {
    id: '4',
    userGroup: '角色4',
    remark: 'XXX4',
    status: 0,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,3'
  },
  {
    id: '5',
    userGroup: '角色5',
    remark: 'XXX5',
    status: 0,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,3'
  },
  {
    id: '6',
    userGroup: '角色6',
    remark: 'XXX6',
    status: 0,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,3'
  },
  {
    id: '7',
    userGroup: '角色7',
    remark: 'XXX7',
    status: 0,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,3'
  },
  {
    id: '8',
    userGroup: '角色8',
    remark: 'XXX8',
    status: 0,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,3'
  },
  {
    id: '9',
    userGroup: '角色9',
    remark: 'XXX9',
    status: 0,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,3'
  },
  {
    id: '10',
    userGroup: '角色10',
    remark: 'XXX10',
    status: 0,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,3'
  },
  {
    id: '11',
    userGroup: '角色11',
    remark: 'XXX11',
    status: 0,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,3'
  },
  {
    id: '12',
    userGroup: '角色12',
    remark: 'XXX12',
    status: 0,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,3'
  },
  {
    id: '13',
    userGroup: '角色13',
    remark: 'XXX13',
    status: 0,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,3'
  },
  {
    id: '14',
    userGroup: '角色14',
    remark: 'XXX14',
    status: 0,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,3'
  },
  {
    id: '15',
    userGroup: '角色15',
    remark: 'XXX15',
    status: 0,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,3'
  },
  {
    id: '16',
    userGroup: '角色16',
    remark: 'XXX16',
    status: 0,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,3'
  },
  {
    id: '17',
    userGroup: '角色17',
    remark: 'XXX17',
    status: 0,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,3'
  },
  {
    id: '18',
    userGroup: '角色18',
    remark: 'XXX18',
    status: 0,
    userIds: '1,2',
    userAdmin: '柏林1、小小2',
    resourceGroup: '资源池1、资源池2',
    resourceIds: '1,3'
  }
]
export default {
  /**
   * get RoleList
   */
  getRoleList (context, payload) {
    return setTimeout(() => {
      context.commit('setRoleList', roleList)
      roleList.length > 0 && context.commit('setCurrentRole', roleList[0])
    }, 500)
  },
  deleteRoleById (context, payload) {
    let index = roleList.findIndex(v => v.id === payload)
    if (index !== -1) {
      roleList.splice(index, 1)
      context.dispatch('getRoleList')
    }
  }
}
